import Controller from '@ember/controller';

export default Controller.extend({
    queryParams: ['category'],
    category: null,

    queryParams: ['page', 'filter', {
        category: 'articles_category'
    }],
    category: null,
    page: 1,
    filter: 'recent',
    filteredArticles: computed('category', 'model', function () {
        let category = this.category;
        let articles = this.model;

        if (category) {
            return articles.filterBy('category', category);
        } else {
            return articles;
        }
    }),
    queryParams: [{
        showMagnifyingGlass: {
            scope: 'controller'
        }
    }],
    queryParams: ['page', 'filter',
        {
            showMagnifyingGlass: {
                scope: 'controller',
                as: 'glass'
            }
        }
    ]
});